package com.ykq.springsecurity04.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @program: springsecurity04
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-01 15:16
 **/
@Controller
public class PageController {

    @GetMapping("info")
    @ResponseBody
    public Authentication info(){
        return SecurityContextHolder.getContext().getAuthentication();
    }

    @PostMapping("/success")
    public String success(){
        ///templates/success.html
        return "success";
    }
}
